﻿<phone:PhoneApplicationPage
    xmlns:my="clr-namespace:TheOliver.Phone.Tools.Primitives;assembly=TheOliver.Phone.Tools"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:my1="clr-namespace:TheOliver.Phone.Tools.Controls;assembly=TheOliver.Phone.Tools"
    xmlns:local="clr-namespace:TheOliver.Phone.BMI"
    x:Class="TheOliver.Phone.BMI.MainPage"
    mc:Ignorable="d"
    d:DesignWidth="480"
    d:DesignHeight="696"
    SupportedOrientations="Portrait"
    Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    Style="{StaticResource TransitionPageStyle}"
    xmlns:my2="clr-namespace:TheOliver.Phone.Tools;assembly=TheOliver.Phone.Tools">
    <phone:PhoneApplicationPage.Resources>
        <my2:Formatter
            x:Key="Formatter1" />
        <local:BMIColorConverter
            x:Key="BMIColorConverter1" />
    </phone:PhoneApplicationPage.Resources>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar>
            <shell:ApplicationBarIconButton
                IconUri="/icons/appbar.save.rest.png"
                IsEnabled="True"
                Text="Speichern" />
            <shell:ApplicationBarIconButton
                IconUri="/icons/appbar.folder.rest.png"
                IsEnabled="True"
                Text="Historie" 
                />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

    <phone:PhoneApplicationPage.FontFamily>
        <StaticResource
            ResourceKey="PhoneFontFamilyNormal" />
    </phone:PhoneApplicationPage.FontFamily>
    <phone:PhoneApplicationPage.FontSize>
        <StaticResource
            ResourceKey="PhoneFontSizeNormal" />
    </phone:PhoneApplicationPage.FontSize>
    <phone:PhoneApplicationPage.Foreground>
        <StaticResource
            ResourceKey="PhoneForegroundBrush" />
    </phone:PhoneApplicationPage.Foreground>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid
        x:Name="LayoutRoot"
        Background="Transparent"
        DataContext="{Binding Source={StaticResource SettingsDataSource}}">
        <Grid.RowDefinitions>
            <RowDefinition
                Height="Auto" />
            <RowDefinition
                Height="*" />
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel
            x:Name="TitlePanel"
            Grid.Row="0"
            Margin="12,17,0,28">
            <TextBlock
                Text="{Binding Strings.ApplicationTitle, Source={StaticResource StringHelper}}"
                Style="{StaticResource PhoneTextTitle2Style}" />
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid
            x:Name="ContentPanel"
            Grid.Row="1"
            Margin="12,0,12,0">
            <StackPanel
                VerticalAlignment="Top">
            	<Grid
            		Margin="12,0">
            		<Grid.RowDefinitions>
            			<RowDefinition
            				Height="Auto"
            				MinHeight="81" />
            		</Grid.RowDefinitions>
            		<Grid.ColumnDefinitions>
            			<ColumnDefinition
            				Width="0.5*" />
            			<ColumnDefinition
            				Width="0.5*" />
            		</Grid.ColumnDefinitions>
            		<TextBlock
            			Text="{Binding Strings.Weight, Source={StaticResource StringHelper}}"
            			Style="{StaticResource PhoneTextLargeStyle}"
            			Margin="0"
            			VerticalAlignment="Center" />
            		<my1:NumberPickerControl
            			x:Name="numberPickerControl1"
            			DataContext="{Binding Weight, Mode=TwoWay}"
            			ShowDecimal="True"
            			Grid.Column="1"
            			HorizontalAlignment="Right"
            			VerticalAlignment="Bottom" />
            	</Grid>
            	<Grid
            		Margin="12,0"
            		VerticalAlignment="Top">
            		<Grid.RowDefinitions>
            			<RowDefinition
            				Height="Auto" />
            		</Grid.RowDefinitions>
            		<Grid.ColumnDefinitions>
            			<ColumnDefinition
            				Width="0.5*" />
            			<ColumnDefinition
            				Width="0.5*" />
            		</Grid.ColumnDefinitions>
            		<TextBlock
            			Text="{Binding Strings.Size, Source={StaticResource StringHelper}}"
            			Style="{StaticResource PhoneTextTitle2Style}"
            			Margin="0"
            			VerticalAlignment="Center" />

            		<my1:NumberPickerControl
            			x:Name="numberPickerControl2"
            			DataContext="{Binding Size, Mode=TwoWay}"
            			ShowDecimal="True"
            			Grid.Column="1"
            			HorizontalAlignment="Right"
            			VerticalAlignment="Bottom" />
            	</Grid>
            	<Grid
            		Margin="12,0">
            		<Grid.RowDefinitions>
            			<RowDefinition
            				Height="Auto" />
            		</Grid.RowDefinitions>
            		<Grid.ColumnDefinitions>
            			<ColumnDefinition
            				Width="0.5*" />
            			<ColumnDefinition
            				Width="0.5*" />
            		</Grid.ColumnDefinitions>
            		<TextBlock
            			Style="{StaticResource PhoneTextLargeStyle}"
            			Text="{Binding Strings.CurrentBMI, Source={StaticResource StringHelper}}"
            			Margin="0"
            			VerticalAlignment="Center" />
            		<TextBlock
            			Text="{Binding BMI, ConverterParameter=\{0:0.0\}, Converter={StaticResource Formatter1}, Mode=OneWay}"
            			Style="{StaticResource PhoneTextTitle1Style}"
            			Margin="0,0,12,0"
            			d:LayoutOverrides="Height"
            			HorizontalAlignment="Right"
            			VerticalAlignment="Bottom"
            			Grid.Column="1"
            			Foreground="{Binding BMI, Converter={StaticResource BMIColorConverter1}}" />

            	</Grid>

            </StackPanel>

            <StackPanel
                Margin="12,0,12,12"
                d:LayoutOverrides="Width, Height"
                VerticalAlignment="Bottom">
                <TextBlock
                    Style="{StaticResource PhoneTextLargeStyle}"
                    Margin="0"
                    VerticalAlignment="Center"
                    Text="{Binding Strings.BMITable, Source={StaticResource StringHelper}}" HorizontalAlignment="Left" />
                <Grid Height="100" Margin="0">
                	<Grid.RowDefinitions>
                		<RowDefinition Height="0.36*"/>
                		<RowDefinition Height="0.64*"/>
                	</Grid.RowDefinitions>
                	<Grid.ColumnDefinitions>
                		<ColumnDefinition Width="Auto" MinWidth="34"/>
                		<ColumnDefinition Width="0.161*"/>
                		<ColumnDefinition Width="0.593*"/>
                		<ColumnDefinition Width="0.246*"/>
                	</Grid.ColumnDefinitions>
                	<Rectangle Grid.ColumnSpan="3" Grid.Row="1" Grid.Column="1">
                		<Rectangle.Fill>
                			<LinearGradientBrush EndPoint="0.996,0.5" StartPoint="-0.023,0.5">
                				<GradientStop Color="Red" Offset="0"/>
                				<GradientStop Color="#FFFFEE35" Offset="0.150"/>
                				<GradientStop Color="#FF4DFF00" Offset="0.300"/>
                				<GradientStop Color="#FF4CFF00" Offset="0.700"/>
								<GradientStop Color="#FFFFEE35" Offset="0.850"/>
								<GradientStop Color="Red" Offset="1"/>
                			</LinearGradientBrush>
                		</Rectangle.Fill>
                	</Rectangle>
                	<TextBlock
                		Style="{StaticResource PhoneTextTitle3Style}"
                		Margin="27,0,-1,0"
                		Text="{Binding Strings.BMILow, Source={StaticResource StringHelper}}" Height="31" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" />
                	<TextBlock
                		Style="{StaticResource PhoneTextTitle3Style}"
                		Margin="0"
                		Text="{Binding Strings.BMIHigh, Source={StaticResource StringHelper}}"
                		Grid.Column="3"
                		HorizontalAlignment="Left" Height="31" VerticalAlignment="Center" d:LayoutOverrides="GridBox" />
                	<TextBlock
                		Style="{StaticResource PhoneTextTitle3Style}"
                		Margin="0"
                		Text="{Binding Strings.BMIMiddle, Source={StaticResource StringHelper}}"
                		Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" />
                	<TextBlock
                		Text="{Binding PerfectRangeMin, ConverterParameter=\{0:0.0\}, Converter={StaticResource Formatter1}, Mode=OneWay}"
                		Style="{StaticResource PhoneTextTitle3Style}"
                		Margin="23,0,0,0"
                		Grid.Row="1" VerticalAlignment="Center" Foreground="Black" Grid.Column="1" d:LayoutOverrides="Width" />
                	<TextBlock
                		Text="{Binding PerfectRangeMax, ConverterParameter=\{0:0.0\}, Converter={StaticResource Formatter1}, Mode=OneWay}"
                		Style="{StaticResource PhoneTextTitle3Style}"
                		Margin="0"
                		Grid.Column="3"
                		Grid.Row="1"
                		HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Black" />
                	<TextBlock
                		Text="{Binding PerfectValue, ConverterParameter=\{0:0.0\}, Converter={StaticResource Formatter1}, Mode=OneWay}"
                		Style="{StaticResource PhoneTextTitle3Style}"
                		Margin="0"
                		Grid.Column="2"
                		Grid.Row="1"
                		HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" />
                	<TextBlock
                		Style="{StaticResource PhoneTextTitle3Style}"
						Text="{Binding Strings.BMI, Source={StaticResource StringHelper}}"
                		Margin="0,0,8,0" Height="31" VerticalAlignment="Center" d:LayoutOverrides="Width" HorizontalAlignment="Right" />
                	<TextBlock
                		Style="{StaticResource PhoneTextTitle3Style}"
						Text="{Binding Strings.KG, Source={StaticResource StringHelper}}"
                		Margin="0,0,8,0" Height="31" VerticalAlignment="Center" d:LayoutOverrides="Width" HorizontalAlignment="Right" Grid.Row="1" />

                </Grid>

            </StackPanel>

        </Grid>
    </Grid>


</phone:PhoneApplicationPage>